-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Publish CI failures to Slack #4477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add pull_request event to notify-slack-on-failure condition - Previously only triggered on push events, missing PR failures
.github/workflows/code-qa.yml
Outdated
| notify-slack-on-failure: | ||
| runs-on: ubuntu-latest | ||
| needs: [check-translations, knip, compile, platform-unit-test, integration-test] | ||
| if: ${{ always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/cte/slack-webhook') && (github.event_name == 'push' || github.event_name == 'pull_request') && contains(needs.*.result, 'failure') }} |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When triggering on pull_request events, github.ref is usually a merge ref (e.g., refs/pull/123/merge) and won’t equal refs/heads/main or refs/heads/cte/slack-webhook. Consider using github.base_ref for PR events to ensure the branch check works as intended.
Suggested change
| if: ${{ always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/cte/slack-webhook') && (github.event_name == 'push' || github.event_name == 'pull_request') && contains(needs.*.result, 'failure') }} | |
| if: ${{ always() && ((github.event_name == 'pull_request' ? github.base_ref : github.ref) == 'refs/heads/main' || (github.event_name == 'pull_request' ? github.base_ref : github.ref) == 'refs/heads/cte/slack-webhook') && (github.event_name == 'push' || github.event_name == 'pull_request') && contains(needs.*.result, 'failure') }} |
- Use github.head_ref for PR branch checking instead of github.ref - github.ref in PRs refers to merge commit, not source branch - Now properly checks source branch name for PR events
- Remove test file slack-webhook-test.spec.ts - Simplify condition to only trigger on pushes to main branch - Remove pull request condition as requested
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
Issue/PR - Triage
New issue. Needs quick review to confirm validity and assign labels.
size:L
This PR changes 100-499 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Make CI failures a bit more loud by publishing to Slack.
Important
Adds Slack notification for CI failures in
code-qa.ymlusing a newslack-notifyaction.slack-notifyaction inaction.ymlto send Slack notifications for workflow failures.failed-jobsJSON to identify failed jobs and formats them for Slack.8398a7/action-slack@v3to send notifications.code-qa.ymlto includenotify-slack-on-failurejob.notify-slack-on-failureruns on main branch push if any job fails.slack-notifyaction to send failure details to Slack channel#ci.This description was created by
for c21119b. You can customize this summary. It will automatically update as commits are pushed.